﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<string>>" %>

<asp:Content ID="userPermissionsTitle" ContentPlaceHolderID="TitleContent" runat="server">
    User Permissions</asp:Content>
<asp:Content ID="userPermissionsContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Push Notifications</h2>
    <p>
        You can send Push Notifications to the following users:</p>
    <table>
        <tr>
            <th>
                User
            </th>
            <th>
                Notification
            </th>
        </tr>
        <%
            foreach (var userName in Model)
            {
                var toastActionUrl = this.Url.Action("SendToastNotification", new { userName = "_user_", message = "_message_" });
                var tileActionUrl = this.Url.Action("SendTileNotification", new { userName = "_user_", message = "_message_" });
                var rawActionUrl = this.Url.Action("SendRawNotification", new { userName = "_user_", message = "_message_" });
        %>
        <tr>
            <td>
                <%: userName %>
            </td>
            <td>
                <% var userId = userName.Replace('.', '_').Replace('#', '_'); %>
                <input type="text" id="<%= userId %>_Message" maxlength="512" />

                <input type="button" value="Send Toast" onclick="SendNotification('<%= userName %>', '<%= toastActionUrl %>')" />
                <input type="button" value="Send Tile" onclick="SendNotification('<%= userName %>', '<%= tileActionUrl %>')" />
                <input type="button" value="Send Raw" onclick="SendNotification('<%= userName %>', '<%= rawActionUrl %>')" />
            </td>
            <td class="PushNotificationStatusColumn" id="<%= userId %>_Sending">
                <img src="/Content/sending.gif" alt="Sending push notification" />
            </td>
            <td class="PushNotificationDescriptionColumn">
                <span id="<%= userId %>_Result"></span>
            </td>
        </tr>
        <% } %>
    </table>
</asp:Content>
